#pragma once
#include "Vector2.h"
#include "Vector3.h"

namespace lib3dw
{
	struct Vector4
	{
		float x, y, z, w;

		Vector4()
		{
			x = y = z = w = 0.0;
		}
		
		Vector4(const float ixyzw)
		{
			x = y = z = w = ixyzw;
		}
		
		Vector4(const float ix, const float iy, const float iz, const float iw)
		{
			x = ix;
			y = iy;
			z = iz;
			w = iw;
		}
		
		Vector4(const Vector2 iv, const float iz, const float iw)
		{
			x = iv.x;
			y = iv.y;
			z = iz;
			w = iw;
		}
		
		Vector4(const float ix, const Vector2 iv, const float iw)
		{
			x = ix;
			y = iv.x;
			z = iv.y;
			w = iw;
		}
		
		Vector4(const float ix, const float iy, const Vector2 iv)
		{
			x = ix;
			y = iy;
			z = iv.x;
			w = iv.y;
		}
		
		Vector4(const Vector2 iv0, const Vector2 iv1)
		{
			x = iv0.x;
			y = iv0.y;
			z = iv1.x;
			w = iv1.y;
		}
		
		Vector4(const Vector3 iv, const float iw)
		{
			x = iv.x;
			y = iv.y;
			z = iv.z;
			w = iw;
		}
		
		Vector4(const float ix, const Vector3 iv)
		{
			x = ix;
			y = iv.x;
			z = iv.y;
			w = iv.z;
		}
		
		void operator += (const float s);
		void operator += (const Vector4 &v);
		void operator -= (const float s);
		void operator -= (const Vector4 &v);
		void operator *= (const float s);
		void operator *= (const Vector4 &v);
		void operator /= (const float s);
		void operator /= (const Vector4 &v);
		operator float *() const { return (float *) &x; }
		Vector3 xyz();
	};

	Vector4 operator + (const Vector4 &u, const Vector4 &v);
	Vector4 operator + (const Vector4 &v, const float s);
	Vector4 operator + (const float s, const Vector4 &v);
	Vector4 operator - (const Vector4 &u, const Vector4 &v);
	Vector4 operator - (const Vector4 &v, const float s);
	Vector4 operator - (const float s, const Vector4 &v);
	Vector4 operator - (const Vector4 &v);
	Vector4 operator * (const Vector4 &u, const Vector4 &v);
	Vector4 operator * (const float s, const Vector4 &v);
	Vector4 operator * (const Vector4 &v, const float s);
	Vector4 operator / (const Vector4 &u, const Vector4 &v);
	Vector4 operator / (const Vector4 &v, const float s);
	Vector4 operator / (const float s, const Vector4 &v);
	bool operator == (const Vector4 &u, const Vector4 &v);
	float dot(const Vector4 &u, const Vector4 &v);
}
